<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>async await</title>
</head>

<body>

</body>
<script>
    async function name(res) {
        return 'hello world';
    }
    console.log(name());
    name().then((res) => {
        console.log('res:', res);
    })
  
    console.log('在函数后面，先执行');
    
    async function f() {
        return await 123;
    }
    f().then((res)=> {
        console.log('res:',res);
    })

    async function a () {
        return new Promise.resolve('hello world');
        return Promise.resolve("hello async");
    }
    
    (async function b () {
        let b = await a();
        console.log('vvvvv:'.b);
    })();
</script>

</html>